/*
 * 作者: 袁燚杰
 * 时间: 2017-03-012
 * 说明：
 * Copyright (c) 2016-2017 中研沃兮
 */
define(function(require) {

	require("jquery");
	require("blur");

	var c = require('app/utils/CommonUtils');
	var UserInfoUtils = require('app/utils/UserInfoUtils');
	var EventUtils = require('app/utils/EventUtils');
	var appInfo = require('app/AppInfo');
	var action = require("./action/IndexMeFrmAction");

	var connect_status = $("#connect_status");
	var btn_start = $("#btn_start_live");
	EventUtils.listen(api.winName, 'VideoUtils', false, function(data) {
		if (data.status == true) {
			connect_status.text("正在直播");
			btn_start.attr("src", "../image/stop_live.png");
		} else {
			connect_status.text("暂停直播");
			btn_start.attr("src", "../image/start_live.png");
		}
	});
	
	EventUtils.listen(api.winName, 'ConnectStatus', false, function(data) {
		if (data.code == 0)
			connect_status.text("未知状态");
		if (data.code == 1)
			connect_status.text("开始连接");
		if (data.code == 2)
			connect_status.text("正在直播");
		if (data.code == 3)
			connect_status.text("连接失败");
		if (data.code == 4)
			connect_status.text("连接销毁");
		if (data.code == 5)
			connect_status.text("网络繁忙");
	});
	$("#btn_start_live").click(function() {
		var data = {};
		data.command = "start";		
		EventUtils.send(api.winName, 'LiveMask', data);
	});

	$("#btn_exit_live").click(function() {
		var data = {};
		data.command = "exit"
		EventUtils.send(api.winName, 'LiveMask', data);
	});

	return;
});
